package com.orange.util;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.net.URLConnection;


import org.apache.log4j.Logger;

public class Gethtmlcode {
	
	private static final Logger log = Logger.getLogger(Gethtmlcode.class);

	public String gethtmlcode(String url){
	String str = "";  
    try {  
        URL u = new URL(url);  
        URLConnection uc = u.openConnection(); 
        InputStream raw = uc.getInputStream();
        System.out.println(raw);
        InputStream buffer = new BufferedInputStream(raw); 
        //  
        Reader r = new InputStreamReader(buffer);  
        int c;  

        while ((c = r.read()) != -1) {  
            str += (char)c;  
            
        } 
    } catch (IOException e) {  
    	log.error("数据写入失败!");
    }
    return str;  
	}
}
